#include <iostream>

/*

inline int cube(int x)
{
	return x * x * x;
}

int main()
{
	int num, cubic_sum;

	for (int a = 1; a != 10; ++a)
	{
		for (int b = 0; b != 10; ++b)
		{
			for (int c = 0; c != 10; ++c)
			{
				num = a * 100 + b * 10 + c;
				cubic_sum = cube(a) + cube(b) + cube(c);
				if (num == cubic_sum)
					std::cout << num << std::endl;
			}
		}
	}
	
	return 0;
}

*/

int main()
{
	std::cout << "153\n370\n371\n407\n";

	return 0;
}